/**
 * 用户相关请求
 */

import request from '@/utils/request'

import store from '@/store/index.js'

/**
 * 登录 
 */

export const login = (data) => {
    return request({
        method: 'POST',
        url: '/app/v1_0/authorizations',
        data: data
    })
}

/**
 * 获取验证码
 */

export const sms = (mobile) => {
    return request({
        method: 'GET',
        url: `/mp/v1_0/sms/codes/:${mobile}`
    })
}

/**
 * 获取登录用户的信息
 */
export const getCurrentUser = () => {
    return request({
        method: 'GET',
        url: '/app/v1_0/user',
        headers: {
            authorization: `Bearer ${store.state.user.token}`
        }
    })
}